use utf8;
use strict;
use warnings;

use POE::Queue::Array;


my $pqa = POE::Queue::Array->new();


foreach my $priority (2, 3, 4, 5, 1) {
    $pqa->enqueue($priority, "payload $priority");
}

# dequeue until the queue is drained

while (1) {
    my ($priority, $queue_id, $payload) = $pqa->dequeue_next();
    last unless defined $priority;
    
    print "dequeued id {$queue_id} priority {$priority} payload {$payload} \n";
}

__END__

